Fix mem leak I introduced earlier tonight (this morning?) in ozi.
authorrobertlipe <robertlipe@gmail.com>
Wed, 11 Sep 2013 07:46:08 +0000 (07:46 +0000)
committerrobertlipe <robertlipe@gmail.com>
Wed, 11 Sep 2013 07:46:08 +0000 (07:46 +0000)
gpsbabel/ozi.cc
gpsbabel/vitosmt.cc

index 2adc9ec3f18da3e9e085d6590152472f0382efdf..54467fe7ea215907008b9f30217aa7a83ebd0c73 100644 (file)
@@ -324,19 +324,20 @@ ozi_route_hdr(const route_head* rte)
 static void
 ozi_route_disp(const waypoint* waypointp)
 {
-  double alt;
   char ozi_time[16];
 
   route_wpt_count++;
 
   ozi_get_time_str(waypointp, ozi_time, sizeof(ozi_time));
 
+/*
+  double alt;
   if (waypointp->altitude == unknown_alt) {
     alt = -777;
   } else {
     alt = waypointp->altitude * alt_scale;
   }
-
+*/
   /*
    *   Field 1 : W - indicating route waypoint details.
    *   Field 2 : Route Number - location in array of routes
@@ -721,7 +722,6 @@ static void
 data_read(void)
 {
   QString buff;
-  char* s = NULL;
   char* trk_name = NULL;
   waypoint* wpt_tmp;
   int i;
@@ -767,7 +767,7 @@ data_read(void)
       }
     } else if ((linecount == 5) && (ozi_objective == trkdata)) {
       int field = 0;
-      s = csv_lineparse(CSTR(buff), ",", "", linecount);
+      char* s = csv_lineparse(CSTR(buff), ",", "", linecount);
       while (s) {
         field ++;
         if (field == 4) {
@@ -783,8 +783,8 @@ data_read(void)
       wpt_tmp = waypt_new();
 
       /* data delimited by commas, possibly enclosed in quotes.  */
-      s = xstrdup(CSTR(buff));
-      s = csv_lineparse(s, ",", "", linecount);
+      char* orig_s = xstrdup(CSTR(buff));
+      char* s = csv_lineparse(orig_s, ",", "", linecount);
 
       i = 0;
       bool header = false;
@@ -813,6 +813,7 @@ data_read(void)
         i++;
         s = csv_lineparse(NULL, ",", "", linecount);
       }
+      xfree(orig_s);
 
       switch (ozi_objective) {
       case trkdata:
index f01cbaaef86bbfdefd1a68997cf5a511ec9f733c..cdc788ae7892151e819b685f6ec6d5de87382a2c 100644 (file)
@@ -318,13 +318,11 @@ vitosmt_waypt_pr(const waypoint* waypointp)
 static void
 vitosmt_write(void)
 {
-  time_t now = 0;
   unsigned char*       workbuffer                                      =0;
   size_t                       position                                        =0;
 
   workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1);
 
-  now = current_time().toTime_t();
   count = 0;
   position = 0;